<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>7_3_1-1-setup方法基础</title>
</head>

<body>


    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <div id="Application">
        <com name="组件名"></com>
    </div>
    <script>
        const App = Vue.createApp({})
        App.component("com", {
            setup(props, context) {
                let data = "setup的数据";
                return { data }
                console.log(props.name)
                //属性
                console.log(context.attrs)
                //插槽
                console.log(context.slots)
                //触发事件
                console.log(context.emit)

            },
            props: {
                name: String,
            },
            template: `<div>props的值：{{name}}，setup返回的值：{{data}}</div>`
        })
        App.mount("#Application")
    </script>
</body>

</html>